decodefilenames=['PeopleDailydecode.txt','ResumeNERdecode.txt','weiboNERdecode.txt']
filenames=['D:/pydataset/PeopleDaily/example.test.bmes','D:/pydataset/ResumeNER/test.char.bmes','D:/pydataset/Weibo/weiboNER.test.bmes']
with open('../data/ComparisonDecode.txt',mode='w',encoding='utf8') as ComparisonDecode:
    for i in range(3):
        ComparisonDecode.write(str(i)+' -----------------------------------------\n')
        linenum = 0
        with open(filenames[i], mode='r', encoding='utf8') as f2:
            for line in open('./data/'+decodefilenames[i], encoding='utf-8'):
                linenum += 1
                line=line.strip('\n')
                # print(line)
                a=line.split(' ')
                b=f2.readline().strip('\n').split(' ')
                if len(line) == 0:
                    print(linenum)
                elif(a[0]!=b[0]):
                    if a[0]!='0':
                        ComparisonDecode.write(str(i)+' '+str(linenum) + ' error----------------')
                        ComparisonDecode.write(' ' + a[0] + ' ' + b[0] + '\n')
                elif(a[1]!=b[1]):
                    ComparisonDecode.write(str(i)+' '+str(linenum))
                    ComparisonDecode.write(' '+a[0]+' '+a[1] +' '+ b[1]+'\n')
                else:
                    ComparisonDecode.write(str(i)+' '+str(linenum)+' '+line+str(b)+'\n')



